package days2.easy.title26;

/**
 * @Author fengzihao
 * @Date 2024-04-16 14:27
 */
class Solution {
    public int removeDuplicates(int[] nums) {
        int count = 0;
        int flag = nums[0];
        for (int i = 1; i < nums.length; i++) {
            if (nums[i]==flag){
                count++;
            }else {
                flag = nums[i];
                nums[i-count] = nums[i];
            }
        }
        return nums.length-count;
    }
}